//
//  HYFolderMoverBottomView.m
//  XPlayer
//
//  Created by liguoqing on 2023/9/19.
//

#import "HYFolderMoverBottomView.h"

#define kItemBtnWidth 130
#define kItemBtnSpace (kScreenWidth - 120*2)/3

@interface HYFolderMoverBottomView ()

@property (nonatomic, strong) NSArray *titles;

@end

@implementation HYFolderMoverBottomView

- (instancetype)initWithTitles:(NSArray *)titles
{
    self = [super init];
    if(self){
        self.titles = titles;
        [self configUI];
    }
    return self;
}

- (void)configUI
{
    self.backgroundColor = APPTabBarThemeColor;
    NSString *newTitle = self.titles.firstObject;
    NSString *lastTitle = self.titles.lastObject;
    [self.newBtn setTitle:newTitle forState:UIControlStateNormal];
    [self.moveBtn setTitle:lastTitle forState:UIControlStateNormal];
    [self addSubview:self.newBtn];
    [self addSubview:self.moveBtn];
    [self.newBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kItemBtnSpace-10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(kItemBtnWidth);
        make.height.mas_equalTo(44);
    }];
    [self.moveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-kItemBtnSpace+10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(kItemBtnWidth);
        make.height.mas_equalTo(44);
    }];
}

- (UIButton *)newBtn
{
    if(!_newBtn){
        _newBtn = [[UIButton alloc]init];
        [_newBtn setTitle:NSLocalizedString(@"新建文件夹", nil) forState:UIControlStateNormal];
        [_newBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
        _newBtn.titleLabel.font = FONT_BOLD_SIZE(16);
        _newBtn.backgroundColor = APPMainThemeColor;
        _newBtn.layer.cornerRadius = 22.0;
        _newBtn.layer.masksToBounds = YES;
    }
    return _newBtn;
}

- (UIButton *)moveBtn
{
    if(!_moveBtn){
        _moveBtn = [[UIButton alloc]init];
        [_moveBtn setTitle:NSLocalizedString(@"移动", nil) forState:UIControlStateNormal];
        [_moveBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
        _moveBtn.titleLabel.font = FONT_BOLD_SIZE(16);
        _moveBtn.backgroundColor = UIColor.systemGreenColor;
        _moveBtn.layer.cornerRadius = 22.0;
        _moveBtn.layer.masksToBounds = YES;
    }
    return _moveBtn;
}


@end
